import request from '@/utils/request'

// 获取所有分类
export function getAllCategories() {
  return request({
    url: '/categories',
    method: 'get'
  })
}

// 根据父分类ID获取子分类
export function getCategoriesByParentId(parentId: number) {
  return request({
    url: `/categories/parent/${parentId}`,
    method: 'get'
  })
}

// 获取分类详情
export function getCategoryById(id: number) {
  return request({
    url: `/categories/${id}`,
    method: 'get'
  })
}
